home *** CD-ROM | disk | FTP | other *** search
/ Quick PC 61 / Quick PC 61.iso / I386 / UDDIWEB.MSI / client.js < prev    next >
Encoding:
JavaScript  |  2003-02-21  |  2.9 KB  |  156 lines

  1. // *************************************************************************
  2. //   UDDI Services
  3. //   Copyright (c) 2002 Microsoft Corporation
  4. //   All Rights Reserved
  5. // *************************************************************************
  6.  
  7. var GetElementById = GetElementById_Initialize;
  8.  
  9. function GetElementById_Initialize( id )
  10. {
  11.     if( null != document.getElementById )            // DOM level 1 conformance        
  12.     {
  13.         GetElementById = function( id ) 
  14.         { 
  15.             return document.getElementById( id ); 
  16.         }                                            
  17.     }
  18.     else if( null != document.all )                    // IE 4.x browsers
  19.     {
  20.         GetElementById = function( id )
  21.         {
  22.             return document.all[ id ];
  23.         }
  24.     }
  25.     else if( null != document.layers )                // Netscape 4.0 browsers
  26.     {
  27.         GetElementById = function( id )
  28.         {
  29.             return GetElementById_Netscape4( id );    
  30.         }
  31.     }
  32.     else                                            // No support
  33.     {
  34.         GetElementById = function( id )
  35.         {
  36.             return null;
  37.         }
  38.     }
  39.     
  40.     return GetElementById( id );
  41. }
  42.  
  43. function GetElementById_Netscape4( id )
  44. {
  45.     var i;
  46.     
  47.     //
  48.     // Check the form elements collection.  Since we only have
  49.     // one form in ASP.NET, we only need to search the first
  50.     // form in the collection.
  51.     //
  52.     for( i = 0; i < document.forms[ 0 ].length; i ++ )
  53.     {
  54.         var e = document.forms[ 0 ].elements[ i ];
  55.         
  56.         if( e.name && id == e.name )
  57.             return e;
  58.     }
  59.  
  60.     //
  61.     // As a last attempt, check the layers collection for the
  62.     // element.
  63.     //    
  64.     return document.layers[ id ];
  65. }
  66.  
  67. function SetFocus( id )
  68. {
  69.     var e = GetElementById( id );
  70.  
  71.     if( null != e && null != e.focus )
  72.         e.focus();
  73. }
  74.  
  75. function Select( id )
  76. {
  77.     var e = GetElementById( id );
  78.     
  79.     if( null != e )
  80.     {
  81.         if( null != e.focus )
  82.             e.focus();
  83.  
  84.         if( null != e.select )
  85.             e.select();            
  86.     }
  87. }
  88.  
  89. function CancelEvent( e )
  90. {
  91.     e.cancelBubble = true;
  92.     e.returnValue = false;
  93. }
  94.  
  95. function Document_OnContextMenu()
  96. {
  97.     var e = window.event;
  98.  
  99.     if( e != null )
  100.         CancelEvent( e );
  101. }
  102.  
  103. function ShowHelp( url )
  104. {
  105.     window.open( url, null, "height=500,width=400,status=yes,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes" );
  106. }
  107.  
  108. function ShowQuickHelp( id )
  109. {
  110.     var e = GetElementById( id );
  111.  
  112.     //
  113.     // ASP.NET uses a different format for id and name.  We first search
  114.     // using the name, then id.
  115.     //
  116.     if( null == e )
  117.         e = GetElementById( id.replace( ":", "_" ) );
  118.  
  119.     if( null != e )
  120.     {
  121.         var i = e.selectedIndex;
  122.         var url = e.options[ i ].value;
  123.         
  124.         ShowHelp( url );                
  125.     }
  126. }
  127.  
  128.  
  129. function MenuItem_Action( sender, action, name )
  130. {
  131.     if( null!=sender )
  132.     {
  133.         switch( action.toLowerCase() )
  134.         {
  135.             case "leave":
  136.                 if( sender.className!=name+"_ItemSelected" )
  137.                 {
  138.                     sender.className=name+"_Item";
  139.                 }
  140.             break;
  141.             
  142.             case "enter":
  143.                 if( sender.className!=name+"_ItemSelected" )
  144.                 {
  145.                     sender.className=name+"_ItemHovor";
  146.                 }
  147.             break;
  148.             
  149.             default:
  150.     
  151.                 alert( "Unknown action: " + action );
  152.             break;
  153.  
  154.         }
  155.     }
  156. }